﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace SY.WebSite
{
    /// <summary>
    /// 属性可以set，是为了反系列化
    /// </summary>
    [Serializable]
    public class Settings
    {
        private string _cookieName;
        private string _domainName;
        private string _domainUrl;
        private string _loginUrl;
        private string _staticFileDomain;
        private string _versionDate;
        private string _title;
        private List<string> _freeUrls;
        private string _systemName;
        private Hashtable _keyValues = new Hashtable();//重要
        private string _unauthorizedText;

        public string CookieName
        {
            get { return _cookieName; }
            set { _cookieName = value; }
        }

        /// <summary>
        /// 类似591up.cn这样的，前面不能有点号
        /// </summary>
        public string DomainName
        {
            get { return _domainName; }
            set { _domainName = value; }
        }

        /// <summary>
        /// 不能以/结尾 2011-01-04
        /// </summary>
        public string DomainUrl
        {
            get { return _domainUrl; }
            set { _domainUrl = value; }
        }

        public string LoginUrl
        {
            get { return _loginUrl; }
            set { _loginUrl = value; }
        }

        public string StaticFileDomain
        {
            get { return _staticFileDomain; }
            set { _staticFileDomain = value; }
        }

        public string VersionDate
        {
            get { return _versionDate; }
            set { _versionDate = value; }
        }

        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        /// <summary>
        /// 系统英文名称，用于记录日志 2010-07-27 
        /// </summary>
        public string SystemName
        {
            get { return _systemName; }
            set { _systemName = value; }
        }

        /// <summary>
        /// 不执行登录检查的页面,比如"/login.aspx"，一律小写
        /// </summary>
        public List<string> FreeUrls
        {
            get { return _freeUrls; }
            set { _freeUrls = value; }
        }

        /// <summary>
        /// 2010-07-27 
        /// </summary>
        public Hashtable KeyValues
        {
            get { return _keyValues; }
            set { _keyValues = value; }
        }

        /// <summary>
        /// 没有权限时候的提示语 2010-07-28 
        /// </summary>
        public string UnauthorizedText
        {
            get { return _unauthorizedText; }
            set { _unauthorizedText = value; }
        }

        /*/// <summary>
        /// 从KeyValues里获取配置值 2010-07-27 
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public string GetValue(string key)
        {
            if (_KeyValues == null)
                return null;
            if (_keyVales.ContainsKey(key))
                return _keyVales[key].ToString();
        }*/

        /*/// <summary>
        /// 获取实例
        /// </summary>
        public Settings()
        {
            load();
        }

        void load()
        {
            //根据程序的配置信息（从XML/数据库等获取配置信息），从指定的地方获取配置
        }*/
        
    }
}
